package com.wcf.proxy.demo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by hadoop on 2016/1/31.
 *
 * 动态代理类
 */
public class ProxyHandler implements InvocationHandler {
    private Object proxied;
    public ProxyHandler(Object proxied){
        this.proxied=proxied;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("调用代理对象之前");
        Object o=method.invoke(proxied,args);
        System.out.println("调用代理对象之后");
        return o;
    }
}
